$(function() {

    $("#submit").click(function (){
        let serverUrl = "http://localhost:8082/doLogin";
        let object = new Object();
        object.name = $("#name").val();
        object.password = $("#password").val();
        $.ajax({
            headers: {
                "X-XSRF-TOKEN": $.cookie("XSRF-TOKEN")
            },
            data:JSON.stringify(object),
            type:"POST",
            dataType:"json",
            async:true,
            contentType: "application/json",
            url:serverUrl,
            success:function(data){
                if(data.code == "1211"){
                    alert(data.message);
                    return;
                }else{
                    alert(data.message);
                    window.location.href = "hello.html";
                }
            }
        });
    });
});